#include "QEmptyProperty.h"

using namespace QPE;

QEmptyProperty::QEmptyProperty(const QString& name)
	: QProperty(name, QVariant::Invalid)
{
}


QEmptyProperty::QEmptyProperty(QPropertyPrivate *d)
	: QProperty(d)
{
}


QEmptyProperty::~QEmptyProperty()
{
	//
}

//! Get the data how it should be displayed
QVariant QEmptyProperty::data (int column, int role) const
{
	if(column == DPC_Data && (Qt::DisplayRole == role || Qt::EditRole == role))
		return QVariant();
	else if(role == Qt::BackgroundRole)
		return QBrush(QColor(217,217,217));
	else if(role == Qt::FontRole)
	{ QFont tmpFont; tmpFont.setBold(true); return tmpFont; }
	else
		return QProperty::data(column, role);
}

//! Returns an editor widget, or NULL if it doesn't supply one
QWidget* QEmptyProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options, const QAbstractItemDelegate* delegate)
{
	Q_UNUSED(options);
	Q_UNUSED(parent);
	Q_UNUSED(delegate);

	return NULL;
}


//! Gets the data from the widget
QVariant QEmptyProperty::getEditorData(QWidget* editor) const
{
	Q_UNUSED(editor);

	return QVariant();
}

//! Returns item flags
Qt::ItemFlags QEmptyProperty::flags(int column) const
{
	Q_UNUSED(column);

	return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}

QString QEmptyProperty::type() const
{
	return "empty";
}

QProperty* QEmptyProperty::clone(bool include_children, QProperty* container) const
{
	return QProperty::clone(include_children, container ? container : new QEmptyProperty(getName()));
}
